#include<bits/stdc++.h>
#define ll long long
using namespace std;

int read() {
    int t = 0, d = 1;
    char c = getchar();

    while(c>'9' || c <'0') {
        if(c == '-') d = -1;
        getchar();
    }
    while(c >= '0' && c <= '9') {
        t = t*10 + c-'0';
        c = getchar();
    }
    return t*d;
}

int n;
int ans, rest;
int num[100005];
priority_queue <int, vector<int>, greater<int> > q;

int main() {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    n = read();
    ans = n;
    rest = n;
    for(int i = 1; i <= n; i++) {
        int a = read();
        if(num[a] == 0) q.push(a);
        num[a] ++;
    }
    int qu = 0, sen = 0;
    while(!q.empty()) {
        int now = q.top();
        q.pop();
        if(qu > num[now]) {
            rest = ans - qu;
            sen = qu - num[now];
        } else {
            rest = ans - num[now];
            sen = 0;
        }
        if(rest < num[now]) {
            ans -= rest;
            break;
        }
        qu = num[now];
        ans -= qu;
        qu = qu + sen;
    }
    printf("%d", ans);
    return 0;
}
